<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.11"/>
<title>Kinetis Bootloader Host: Json::ValueArrayAllocator Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
  $(window).load(resizeHeight);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
  $(document).ready(function() { init_search(); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="nxp_logo_small.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Kinetis Bootloader Host
   &#160;<span id="projectnumber">2.0.0</span>
   </div>
   <div id="projectbrief">Host Tools for Kinetis devices</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.11 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Introduction</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.png"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
          </span>
        </div>
      </li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="classes.html"><span>Class&#160;Index</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('class_json_1_1_value_array_allocator.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_json_1_1_value_array_allocator-members.html">List of all members</a>  </div>
  <div class="headertitle">
<div class="title">Json::ValueArrayAllocator Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div>  </div>
</div><!--header-->
<div class="contents">

<p>Experimental: do not use. Allocator to customize <a class="el" href="class_json_1_1_value.html" title="Represents a JSON value. ">Value</a> internal array. Below is an example of a simple implementation (actual implementation use memory pool).  
 <a href="class_json_1_1_value_array_allocator.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="json_8h_source.html">json.h</a>&gt;</code></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:aa4e33df2e64dc9feac059282a8a30dc2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aa4e33df2e64dc9feac059282a8a30dc2"></a>
virtual <a class="el" href="class_json_1_1_value_internal_array.html">ValueInternalArray</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>newArray</b> ()=0</td></tr>
<tr class="separator:aa4e33df2e64dc9feac059282a8a30dc2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abcf14cbbd0c665f82797490a33f7a9c3"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="abcf14cbbd0c665f82797490a33f7a9c3"></a>
virtual <a class="el" href="class_json_1_1_value_internal_array.html">ValueInternalArray</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>newArrayCopy</b> (const <a class="el" href="class_json_1_1_value_internal_array.html">ValueInternalArray</a> &amp;other)=0</td></tr>
<tr class="separator:abcf14cbbd0c665f82797490a33f7a9c3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a312a85597a5b4f7b4301e407c8cbaa6a"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a312a85597a5b4f7b4301e407c8cbaa6a"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>destructArray</b> (<a class="el" href="class_json_1_1_value_internal_array.html">ValueInternalArray</a> *array)=0</td></tr>
<tr class="separator:a312a85597a5b4f7b4301e407c8cbaa6a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aedd2bbdd03efcd3ee5443ba7ed6b31aa"><td class="memItemLeft" align="right" valign="top">virtual void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_json_1_1_value_array_allocator.html#aedd2bbdd03efcd3ee5443ba7ed6b31aa">reallocateArrayPageIndex</a> (<a class="el" href="class_json_1_1_value.html">Value</a> **&amp;indexes, ValueInternalArray::PageIndex &amp;indexCount, ValueInternalArray::PageIndex minNewIndexCount)=0</td></tr>
<tr class="memdesc:aedd2bbdd03efcd3ee5443ba7ed6b31aa"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reallocate array page index. Reallocates an array of pointer on each page.  <a href="#aedd2bbdd03efcd3ee5443ba7ed6b31aa">More...</a><br /></td></tr>
<tr class="separator:aedd2bbdd03efcd3ee5443ba7ed6b31aa"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a838b829cad59435fa6d4bef18d4207af"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a838b829cad59435fa6d4bef18d4207af"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>releaseArrayPageIndex</b> (<a class="el" href="class_json_1_1_value.html">Value</a> **indexes, ValueInternalArray::PageIndex indexCount)=0</td></tr>
<tr class="separator:a838b829cad59435fa6d4bef18d4207af"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a29d3910522b772b42ccf91bab8fcde7d"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a29d3910522b772b42ccf91bab8fcde7d"></a>
virtual <a class="el" href="class_json_1_1_value.html">Value</a> *&#160;</td><td class="memItemRight" valign="bottom"><b>allocateArrayPage</b> ()=0</td></tr>
<tr class="separator:a29d3910522b772b42ccf91bab8fcde7d"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aca83d9d1a0181ba6e3db34bfef3c7467"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="aca83d9d1a0181ba6e3db34bfef3c7467"></a>
virtual void&#160;</td><td class="memItemRight" valign="bottom"><b>releaseArrayPage</b> (<a class="el" href="class_json_1_1_value.html">Value</a> *value)=0</td></tr>
<tr class="separator:aca83d9d1a0181ba6e3db34bfef3c7467"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Experimental: do not use. Allocator to customize <a class="el" href="class_json_1_1_value.html" title="Represents a JSON value. ">Value</a> internal array. Below is an example of a simple implementation (actual implementation use memory pool). </p>
<div class="fragment"><div class="line"><span class="keyword">class </span>DefaultValueArrayAllocator : <span class="keyword">public</span> ValueArrayAllocator</div><div class="line">{</div><div class="line"><span class="keyword">public</span>: <span class="comment">// overridden from ValueArrayAllocator</span></div><div class="line"><span class="keyword">virtual</span> ~DefaultValueArrayAllocator()</div><div class="line">{</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">virtual</span> ValueInternalArray *newArray()</div><div class="line">{</div><div class="line">   <span class="keywordflow">return</span> <span class="keyword">new</span> ValueInternalArray();</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">virtual</span> ValueInternalArray *newArrayCopy( <span class="keyword">const</span> ValueInternalArray &amp;other )</div><div class="line">{</div><div class="line">   <span class="keywordflow">return</span> <span class="keyword">new</span> ValueInternalArray( other );</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">virtual</span> <span class="keywordtype">void</span> destruct( ValueInternalArray *array )</div><div class="line">{</div><div class="line">   <span class="keyword">delete</span> array;</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_json_1_1_value_array_allocator.html#aedd2bbdd03efcd3ee5443ba7ed6b31aa">reallocateArrayPageIndex</a>( Value **&amp;indexes,</div><div class="line">                                       ValueInternalArray::PageIndex &amp;indexCount,</div><div class="line">                                       ValueInternalArray::PageIndex minNewIndexCount )</div><div class="line">{</div><div class="line">   ValueInternalArray::PageIndex newIndexCount = (indexCount*3)/2 + 1;</div><div class="line">   <span class="keywordflow">if</span> ( minNewIndexCount &gt; newIndexCount )</div><div class="line">      newIndexCount = minNewIndexCount;</div><div class="line">   <span class="keywordtype">void</span> *newIndexes = realloc( indexes, <span class="keyword">sizeof</span>(Value*) * newIndexCount );</div><div class="line">   <span class="keywordflow">if</span> ( !newIndexes )</div><div class="line">      <span class="keywordflow">throw</span> std::bad_alloc();</div><div class="line">   indexCount = newIndexCount;</div><div class="line">   indexes = <span class="keyword">static_cast&lt;</span>Value **<span class="keyword">&gt;</span>( newIndexes );</div><div class="line">}</div><div class="line"><span class="keyword">virtual</span> <span class="keywordtype">void</span> releaseArrayPageIndex( Value **indexes,</div><div class="line">                                    ValueInternalArray::PageIndex indexCount )</div><div class="line">{</div><div class="line">   <span class="keywordflow">if</span> ( indexes )</div><div class="line">      free( indexes );</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">virtual</span> Value *allocateArrayPage()</div><div class="line">{</div><div class="line">   <span class="keywordflow">return</span> <span class="keyword">static_cast&lt;</span>Value *<span class="keyword">&gt;</span>( malloc( <span class="keyword">sizeof</span>(Value) * ValueInternalArray::itemsPerPage ) );</div><div class="line">}</div><div class="line"></div><div class="line"><span class="keyword">virtual</span> <span class="keywordtype">void</span> releaseArrayPage( Value *value )</div><div class="line">{</div><div class="line">   <span class="keywordflow">if</span> ( value )</div><div class="line">      free( value );</div><div class="line">}</div><div class="line">};</div></div><!-- fragment --> </div><h2 class="groupheader">Member Function Documentation</h2>
<a class="anchor" id="aedd2bbdd03efcd3ee5443ba7ed6b31aa"></a>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
  <tr>
  <td class="mlabels-left">
      <table class="memname">
        <tr>
          <td class="memname">virtual void Json::ValueArrayAllocator::reallocateArrayPageIndex </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="class_json_1_1_value.html">Value</a> **&amp;&#160;</td>
          <td class="paramname"><em>indexes</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">ValueInternalArray::PageIndex &amp;&#160;</td>
          <td class="paramname"><em>indexCount</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">ValueInternalArray::PageIndex&#160;</td>
          <td class="paramname"><em>minNewIndexCount</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
  </td>
  <td class="mlabels-right">
<span class="mlabels"><span class="mlabel">pure virtual</span></span>  </td>
  </tr>
</table>
</div><div class="memdoc">

<p>Reallocate array page index. Reallocates an array of pointer on each page. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">indexes</td><td>[input] pointer on the current index. May be <code>NULL</code>. [output] pointer on the new index of at least <em>minNewIndexCount</em> pages. </td></tr>
    <tr><td class="paramname">indexCount</td><td>[input] current number of pages in the index. [output] number of page the reallocated index can handle. <b>MUST</b> be &gt;= <em>minNewIndexCount</em>. </td></tr>
    <tr><td class="paramname">minNewIndexCount</td><td>Minimum number of page the new index must be able to handle. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<hr/>The documentation for this class was generated from the following file:<ul>
<li><a class="el" href="json_8h_source.html">json.h</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><a class="el" href="namespace_json.html">Json</a></li><li class="navelem"><a class="el" href="class_json_1_1_value_array_allocator.html">ValueArrayAllocator</a></li>
    <li class="footer">Generated on Mon Mar 7 2016 16:49:52 for Kinetis Bootloader Host by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.11 </li>
  </ul>
</div>
</body>
</html>
